﻿using MesBLL.Common;
using MesDAL.DBInfo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MesBLL.EventService
{
    public class MachineInfoService : CommonService<machine_info>
    {
        public async Task<List<machine_info>> SelectFormMachineStatus()
        {
            return await Task.Run(() => GetAll().ToList());
        }

        public async Task<machine_info> SelectMachineInfoByMachineNum(string machineNum)
        {
            return await Task.Run(() => GetAll().Where(m => m.machine_num.Equals(machineNum)).FirstOrDefault());
        }

        public async Task<List<machine_info>> SelectMachineInfoByMachineClass(string name)
        {
            return await Task.Run(() => GetAll().Where(m => m.machine_class.Equals(name)).ToList());
        }

        public async Task<List<machine_info>> SelectMachineInfoMessage()
        {
            return await Task.Run(() => GetAll().Where(x => x.machine_class.Equals("CNC") || x.machine_class.Equals("KS") || x.machine_class.Equals("G") || x.machine_class.Equals("EDM")).ToList());
            //return await Task.Run(() => GetAll().ToList());
        }
    }
}
